package me.xue.communityhealth.repo;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface PostRepository {

    @Insert("INSERT INTO `post` VALUES(#{name})")
    int save(String name);

    @Update("UPDATE `post` SET `name`=#{new} WHERE `name`=#{old}")
    int update(@Param("old") String oldName, @Param("new") String newName);

    @Delete("DELETE FROM `post` WHERE `name`=#{name}")
    int delete(String name);

    @Select("SELECT * FROM `post`")
    List<String> findAll();

}
